class VariableContainer {
  _value: any
  constructor(e) {
    this._value = e
  }
  value() {
    return this._value
  }
  set(e) {
    this._value = e
  }
}
export default class PersistentStorage {
  storage: Record<string, any>
  constructor() {
    this.storage = {}
  }
  get(e: string, t: () => any) {
    let i = this.storage[e]
    i = i || t()
    this.storage[e] = i
    return i
  }
  getNumber(e) {
    return this.get(e, () => new VariableContainer(0))
  }
  getString(e) {
    return this.get(e, () => new VariableContainer(""))
  }
  getArray(e) {
    return this.get(e, () => [])
  }
  getNumberMap(e) {
    return this.get(e, () => ({}))
  }
  getStringMap(e) {
    return this.get(e, () => ({}))
  }
}
